﻿using Enyim.Caching;
using Ayatta.Contract;
using System.Web.Mvc;
using Web.Base.Security;
using Web.Seller.Models;

namespace Web.Seller.Controllers
{
    public class RefundController : SellerBaseController
    {

        public RefundController(ILogService logService, IBaseService baseService, IExtraService extraService, IStoreService storeService, IOrderService orderService, IGameService gameService, IAuctionService auctionService, IPassportService passportService, IPaymentService paymentService, IMemcachedClient memcachedClient)
            : base(logService, baseService, extraService, storeService, orderService, gameService, auctionService, passportService, paymentService, memcachedClient)
        {
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Detail(string param)
        {
            var identity = User.Identity.Identity();
            var model = new RefundControllerModel.Detail();

            var refund = OrderService.GetRefund(param, identity.Id,true);
            if (refund != null)
            {
                var orderItem = OrderService.GetOrderItem(refund.OrderItemId, identity.Id, false, true);
                model.OrderItem = orderItem;
            }
            model.Refund = refund;
            ViewBag.Sidebar = false;
            return View(model);
        }
    }
}
